package com.bjsxt.usersCenter.common.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.stereotype.Component;

/**
 * 常用的日期工具类
 * @author Administrator
 *
 */
@Component("dateFormatUtil")
public class DateFormatUtil
{
	public String format(Date nowDate)
	{
		SimpleDateFormat sdf=new SimpleDateFormat(ConstatFinalUtil.bundle.getString("format.datetime"));
		return sdf.format(nowDate);
		
		
	}
	public String formatDate(Date nowDate)
	{
		SimpleDateFormat sdf=new SimpleDateFormat(ConstatFinalUtil.bundle.getString("format.date"));
		return sdf.format(nowDate);
		
		
	}
	public Date parse(String now)
	{
		try
		{
			SimpleDateFormat sdf=new SimpleDateFormat(ConstatFinalUtil.bundle.getString("format.datetime"));
			return sdf.parse(now);
		} catch (ParseException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return null;
		
	}
	public Date parseDate(String now)
	{
		try
		{
			SimpleDateFormat sdf=new SimpleDateFormat(ConstatFinalUtil.bundle.getString("format.date"));
			return sdf.parse(now);
		} catch (ParseException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return null;
	}
}
